import QtQuick
import QtQuick.Controls
import QtQuick.Layouts

ApplicationWindow {
    visible: true
    width: 600
    height: 500
    title: "QML菜单示例"

    ColumnLayout {
        anchors.fill: parent
        spacing: 10
        anchors.margins: 10

        // 示例选择区域
        RowLayout {
            Layout.fillWidth: true
            spacing: 10

            Button {
                text: "示例1：ContextMenu"
                onClicked: loader.source = "Menu1.qml"
            }
            Button {
                text: "示例2：菜单栏"
                onClicked: loader.source = "Menu2.qml"
            }
            Button {
                text: "示例3：动态菜单"
                onClicked: loader.source = "Menu3.qml"
            }
            Button {
                text: "示例4：快捷键菜单"
                onClicked: loader.source = "Menu4.qml"
            }
            Button {
                text: "示例5：可选项菜单"
                onClicked: loader.source = "Menu5.qml"
            }
        }

        // 示例显示区域
        Rectangle {
            Layout.fillWidth: true
            Layout.fillHeight: true
            color: "#f0f0f0"
            border.color: "#cccccc"
            border.width: 1

            Loader {
                id: loader
                anchors.centerIn: parent
                source: "Menu1.qml"  // 默认加载第一个示例
            }
        }

        // 说明文本
        Text {
            Layout.fillWidth: true
            text: "当前示例说明：\n" +
                  "示例1：右键点击按钮显示上下文菜单\n" +
                  "示例2：顶部菜单栏，包含子菜单\n" +
                  "示例3：动态生成的菜单项\n" +
                  "示例4：支持快捷键的菜单\n" +
                  "示例5：包含复选框和单选按钮的菜单"
            wrapMode: Text.Wrap
            color: "#666666"
        }
    }
} 
